$(function(){
	//请求数据展示到页面上
	$.ajax({
				type: "post",
				url: "http://a.91jfk.com/Product/Order/goods_luck",
				success: function(res) {
					console.log(res);
						for(var i = 0; i < res.msg.length; i++){
							if(res.msg[i].state == "1"){
								showItem(res.msg[i].thumbnail,res.msg[i].pname,res.msg[i].create_time,res.msg[i].send_time,res.msg[i].id);
							}else{
								showItem(res.msg[i].thumbnail,res.msg[i].pname,res.msg[i].create_time,res.msg[i].send_time,res.msg[i].id);
							}
						}
				},
				error: function(err) {
					console.log(err)
				}
			});
			
			//动态创建标签
			function showItem(src,name,time,send,id){
				var prize_content = $(".prize_content");
				var id = $('<div class="id" style="display:none">' + id + '</div>');
				var type = $('<div class="type"><div class="img"><img  src="' + src + '"/></div><div class="right"><p>' + name +'</p><p>' + time +'</p><p>' + send + '</p></div></div>');
				var img = $('<img class="zuobiao" src=""/>');
				type.append(img).append(id);
				prize_content.append(type);
				$(".zuobiao").attr("src","/Public/Product/img/zuobiao.png");
			}
			$(".prize_content").on("click",".type",function(){
				var storage = window.localStorage;
				var id = $(this).children(".id").text();
				storage.setItem("prize_id",id);
				console.log(id);
				window.location.href = "my_prize_detail.html";
			});
			
			
})
